home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / bin / getprinters.z / getprinters
Encoding:
Text File  |  1997-01-22  |  669 b   |  28 lines

  1. #! /bin/sh
  2. # generate a list of printers, with the default printer at the start of
  3. # the list.  Outputs an appropriate "set printer" command in the specified
  4. # file.  Assumes the SysV printer driver, with "lpstat", is available.
  5.  
  6. getlp='lpstat -v'
  7. parse1='s/.*device for //'
  8. parse2='s/:.*//'
  9.  
  10. case `(arch) 2>/dev/null` in
  11. sun4)
  12.     default=`(lpstat -d) 2>&1 | awk '{ print $4 }' | sed 's/,//'`;;
  13. *)
  14.     default=`(lpstat -d) 2>/dev/null | sed 's/.*: //'`;;
  15. esac
  16.  
  17. case $default in
  18. ''|'no system default'*)
  19.     : > $1
  20.     ;;
  21. *)
  22.   printers=`echo $default;
  23.         $getlp | sed -e "$parse1" -e "$parse2" | grep -v "^$default$"`
  24.  
  25.   echo set printer=\'$printers\' > $1
  26.   ;;
  27. esac
  28.